<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        <script src="js/time.js?"></script>
        <script language='javascript'>
        
        //显示物品类型
    	function showobject()
    	{
    	
    		var material = $('#material_type').val();
    		//alert(tableenum);
    		//alert(i);
    		//判断选的模块名是否合法 之前是否已经选择过了？

    		var objList = <?=json_encode($objecttype)?>;
    		var strOption = '';
    		for(var one in objList[material])
    	    {
    	    	strOption += '<option value="'+one+'" >'+objList[material][one]['name']+'</option>';
    	    }
    		//alert('material = '+material+" stroption "+strOption); 
    		$('#object_id').html(strOption);
    	} 

    	//显示职业类型
    	function showoprofession()
    	{
    		var material = $('#material_type').val();
    		var objectid = $('#object_id').val();
    		//alert('material:'+material+" objectid:"+objectid);
    		//alert(i);
    		//判断选的模块名是否合法 之前是否已经选择过了？

    		var objList = <?=json_encode($objecttype)?>;
    		var professionlist = <?=json_encode($professiontype)?>;
    		//alert(professionlist);
    		var strOption;
    		if( 10 == material)	//表示是装备
    		{
        		var p = objList[material][objectid]['profession'];
    			strOption='<input type="hidden" name="row[profession]" value="'+p+'" />'
        			+professionlist[p];	
    		}else
    		{
    			strOption='<input type="hidden" name="row[profession]" value="-1"/>'
        			+professionlist[-1];	//其它都是通用
    		}
    		//alert(' material = '+material+" objectid:"+objectid+" stroption "+strOption); 
    		$('#profession').html(strOption);
    	} 
    	
        </script>
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        <?php
        	//print_r($objecttype) ;
        ?>
        <form action="" method="POST" id="rowForm">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
            	<!-- 
                <tr>
                    <td><?= translate('C_SELECT_AREA_TEXT') ?>:</td>
                    <td><?= $arealist ?></td>
                </tr>
                 -->
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_BOX_ID') ?></td>
                    <td>
                    	<select name="row[box_id]" id="box_id">
						<?php  foreach ($boxtype as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
                    </td>
                </tr>
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_CHOICE_TYPE') ?></td>
                    <td>
                    	<select name="row[choice_type]" id="choice_type">
						<?php  foreach ($numbertype as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
                    </td>
                </tr>
                
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_MATERIAL_TYPE') ?></td>
                    <td>
                    	<select name="row[material_type]" id="material_type" onChange="showobject()">
                    	<option value="-1"><?= translate('PLASE_SELECT') ?></option>
						<?php  foreach ($materialtype as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
                    </td>
                </tr>
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_OBJECT_NAME') ?></td>
                    <td>
                    	<select name="row[object_id]" id="object_id" onChange="showoprofession()">
                    	<option value="-1"><?= translate('MALL_TREASUREBOXRATIO_PLEASE_SELECT_KIND') ?></option>
						</select>
                    </td>
                </tr>
                
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_PROFESSION') ?></td>
                    <td id = "profession">
                    	<?= translate('MALL_TREASUREBOXRATIO_PLEASE_SELECT_OBJECT') ?>
                    	<!--  
                    	<select name="row[profession]" id="profession">
						<?php  foreach ($professiontype as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
					 	-->
                    </td>
                </tr>
                <!-- 
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_ISFOREVER') ?></td>
                    <td>
                    	<select name="row[box_id]" id="box_id">
						<?php  foreach ($boxtype as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
                    </td>
                </tr>
                 -->
                 <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_LEVEL_TYPE') ?></td>
                    <td>
                    	<select name="row[level_type]" id="level_type">
						<?php  foreach ($playerlevel as $key => $value) { ?>
							<option value="<?=$key ?>"><?=$value ?></option>
						<?php } ?>
						</select>
                    </td>
                </tr>
                <tr>
                    <td><?= translate('MALL_TREASUREBOXRATIO_RATION') ?></td>
                    <td>
                    	<input type="text" name="row[ration]" id="ration" size="25" />
                    </td>
                </tr>
                
                 <tr><td><?= translate('STARTTIME') ?>:</td><td>
                	<input type="text" name="row[starttime]" id="starttime" size="25" onClick="SelectDate(this,'yyyy-MM-dd hh:mm:ss',0,10)"/>
                </td></tr>
                <tr><td><?= translate('ENDTIME') ?>:</td><td>
                	<input type="text" name="row[endtime]" id="endtime" size="25" onClick="SelectDate(this,'yyyy-MM-dd hh:mm:ss',0,10)"/>
                </td></tr>
                
                <tr>
                    <td></td>
                    <td><input type="submit" value="<?= translate('SUBMIT') ?>" id="submit" /> <input type="reset" value="<?= translate('RESET') ?>" id="reset" /></td>
                </tr>
            </table>
        </form>
        <script type="text/javascript">
            SG.init("core.form", function() {
                $.formValidator.initConfig({formid: "#rowForm", submitonce: true});
                $("#area_host").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                $("#starttime").formValidator({empty: false, onshow: '<?= translate('C_ONLY_NUM') ?>'}).regexValidator({regexp: "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s((([0-1][0-9])|(2?[0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$", onerror: '<?= translate('C_INVALID_TIME') ?>'});
                $("#endtime").formValidator({empty: false, onshow: '<?= translate('C_NOT_EMPTY') ?>'}).regexValidator({regexp: "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s((([0-1][0-9])|(2?[0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$", onerror: '<?= translate('C_INVALID_TIME') ?>'});
                $("#ration").formValidator({empty: false, onshow: '<?= translate('C_NOT_EMPTY') ?>'}).regexValidator({regexp: 'num', datatype: 'enum', onerror: '<?= translate('C_ONLY_NUM') ?>'});
                });
        </script>
    </body>
</html>